home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 7 / BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso / Files / Prog / B-C / C Quick Reference 1.0.cpt / C Quick Reference 1.0.rsrc / TEXT_-15392_CQR.txt < prev    next >
Encoding:
Text File  |  1990-12-08  |  6.6 KB  |  215 lines

  1. ‚Ä¢‚Ä¢‚Ä¢ PASCAL TO C CONVERSIONS‚Ć
  2.  
  3. INTEGER               int
  4. LONGINT               long
  5. CHAR                  int
  6. BOOLEAN               char
  7. Byte                  Byte(struct), int(passed)
  8. VAR Byte              int *
  9. Handle                Handle
  10. VAR Handle            Handle *
  11. Ptr                   Ptr
  12. VAR Ptr               Ptr *
  13. OSType, ResType       long
  14. PACKED ARRAY[]        long
  15. String255             Str255 or char *
  16. VAR String255         Str255 or char *
  17. StringPtr             StrPtr or char *
  18. VAR StringPtr         StrPtr * or char *
  19. Rect                  Rect *
  20. VAR Rect              Rect *
  21. Point                 Point
  22. VAR Point             Point *
  23.  
  24. ‚Ä¢‚Ä¢‚Ä¢ DATA TYPES AND SIZES (IN BYTES)‚Ć
  25.  
  26. char                  1
  27. short                 2
  28. int                   2
  29. long                  4
  30. float                 4
  31. short double          8
  32. double                10 (12 w/68881 option)
  33. Ptr                   4
  34. Handle                4
  35. Byte                  1
  36. Boolean               1
  37. Str255                256 (4 when passed)
  38.  
  39. ‚Ä¢‚Ä¢‚Ä¢ OBJECT PASSING
  40.  
  41. VAR Parameter         a pointer to the object
  42. 4 bytes or smaller    the object
  43. larger than 4 bytes   a pointer to the object
  44.  
  45. ‚Ä¢‚Ä¢‚Ä¢ STRUCT AND PTR RELATIONS
  46.  
  47. structure.item           == (*structure_ptr).item     == structure_ptr->item
  48. *(character_ptr)         == character_ptr[0]
  49. *(character_ptr + n)     == character_ptr[n]
  50.  
  51. ‚Ä¢‚Ä¢‚Ä¢ OPERATOR ASSOCIATIVITY AND PRECEDENCE
  52.  
  53. LR         () [] -> .
  54. RL         ! ~ ++ -- - * & (type) sizeof
  55. LR         * / %
  56. LR         + -
  57. LR         << >>
  58. LR         < <= > >=
  59. LR         == !=
  60. LR         &
  61. LR         ^
  62. LR         |
  63. LR         &&
  64. LR         ||
  65. RL         ?:
  66. RL         = += -= *= /= %= &= ^= |= <<= >>=
  67. LR         ,
  68.  
  69. ‚Ä¢‚Ä¢‚Ä¢ CHARACTER CONSTANTS
  70.  
  71. newline              NL(LF)      \n
  72. horizontal tab       HT          \t
  73. vertical tab         VT          \v
  74. backspace            BS          \b
  75. carriage return      CR          \r
  76. formfeed             FF          \f
  77. alert                BEL         \a
  78. backslash            \           \\
  79. question mark        ?           \?
  80. single quote         '           \'
  81. double quote         "           \"
  82. octal number         ooo         \ooo
  83. hexadecimal number   xhh         \xhh
  84. NUL character        NUL         \0
  85.  
  86. ‚Ä¢‚Ä¢‚Ä¢ PREPROCESSOR COMMANDS
  87.  
  88. #define        identifier token-sequence
  89. #define        identifier (identifier-list) token-sequence
  90. #undef         identifier
  91. #include       <filename>
  92. #include       "filename"
  93. #include       token-sequence
  94. #line          constant "filename"
  95. #line          constant
  96. #error         token-sequence(opt)
  97. #pragma^       token-sequence(opt)
  98. #              NULL
  99. #if            constant-expression
  100. #ifdef         identifier
  101. #ifndef        identifier
  102. #elif          constant-expression
  103. #else
  104. #endif
  105.  
  106. ‚Ä¢‚Ä¢‚Ä¢ RESERVED KEYWORDS
  107.  
  108. auto        double      int         struct
  109. break       else        long        switch
  110. case        enum        register    typedef
  111. char        extern      return      union
  112. const^      float       short       unsigned
  113. continue    for         signed^     void
  114. default     goto        sizeof      volatile^
  115. do          if          static      while
  116. asm‚Ć        pascal‚Ć
  117.  
  118. ‚Ä¢‚Ä¢‚Ä¢ STANDARD LIBRARY
  119.  
  120. <assert.h>    <float.h>    <math.h>      <stdarg.h>    <stdlib.h>
  121. <ctype.h>     <limits.h>   <setjmp.h>    <stddef.h>    <string.h>
  122. <errno.h>     <locale.h>   <signal.h>    <stdio.h>     <time.h>
  123.  
  124. ‚Ä¢‚Ä¢‚Ä¢ SCANF: <stdio.h>
  125.  
  126. %d       decimal integer             int *
  127. %i       integer                     int *
  128. %o       octal integer               int *
  129. %u       unsigned decimal integer    unsigned int *
  130. %x       hexadecimal integer         int *
  131. %c       characters                  char *
  132. %s       string                      char[] or char *
  133. %e,f,g   floating-point number       float *
  134. %p       pointer                     void *
  135. %%       literal %
  136.  
  137. ‚Ä¢‚Ä¢‚Ä¢ PRINTF: <stdio.h>
  138.  
  139. %d,i     decimal notation            int
  140. %o       unsigned octal              int
  141. %x,X     unsigned hexadecimal        int
  142. %u       unsigned decimal            unsigned int
  143. %c       character                   int or char
  144. %s       string                      char[] char *
  145. %f       decimal notation            double or float
  146. %e,E     exponential notation        double or float
  147. %g,G     use shorter of %e or %f     double or float
  148. %p       pointer                     void *
  149. %%       literal %
  150.  
  151. ‚Ä¢‚Ä¢‚Ä¢ MATHEMATICAL FUNCTIONS: <math.h>
  152.  
  153. sin(x)           sine of x
  154. cos(x)           cosine of x
  155. tan(x)           tangent of x
  156. asin(x)          sin-1(x)
  157. acos(x)          cos-1(x)
  158. atan(x)          tan-1(x)
  159. atan2(y,x)       tan-1(x/y)
  160. sinh(x)          hyperbolic sine of x
  161. cosh(x)          hyperbolic cosine of x
  162. tanh(x)          hyperbolic tangent of x
  163. exp(x)           exponential function
  164. log(x)           natural logarithm
  165. log10(x)         base 10 logarithm
  166. pow(x,y)         x to the power of y
  167. sqrt(x)          square root of x
  168. ceil(x)          smallest integer not less than x
  169. floor(x)         largest integer not greater than x
  170. fabs(x)          absolute value
  171. fmod(x,y)        floating-point remainder of x/y
  172.  
  173. ‚Ä¢‚Ä¢‚Ä¢ STRING FUNCTIONS: <string.h>
  174.  
  175. strcat(s,t)      concat t to the end of s
  176. strncat(s,t,n)   concat n characters of t to end of s
  177. strcmp(s,t)      <0 if(s<t), 0 if(s==t), >0 if(s>t)
  178. strncmp(s,t,n)   same as strcmp but only in first n characters
  179. strcpy(s,t)      copy t into s
  180. strncpy(s,t,n)   copy at most n characters of t into s
  181. strlen(s)        return length of s
  182. strchr(s,c)      return pointer to first c in s, else NULL
  183. strrchr(s,c)     return pointer to last c in s, else NULL
  184.  
  185. ‚Ä¢‚Ä¢‚Ä¢ CHARACTER CLASS TESTS: <ctype.h>
  186.  
  187. isalpha(c)       non-zero if c is alphabetic; 0 if not
  188. isupper(c)       non-zero if c is upper case; 0 if not
  189. islower(c)       non-zero if c is lower case; 0 if not
  190. isdigit(c)       non-zero if c is a digit(0..9); 0 if not
  191. isalnum(c)       non-zero if isalpha(c) or isdigit(c); 0 if not
  192. isspace(c)       non-zero if c is blank, \t, \n, \r, \f, \v
  193. toupper(c)       return c converted to upper case
  194. tolower(c)          return c converted to lower case    
  195.  
  196. ‚Ä¢‚Ä¢‚Ä¢ ABOUT C QUICK REFERENCE
  197.  
  198. C Quick Reference (CQR) is compiled by Stephen D. Krans.  CQR is FREE so please distribute it unmodified to anyone interested in writing C Code.  If you have any comments, questions, or suggestions, please contact me through one of the following electronic addresses:
  199.  
  200. GEnie: SKRANS
  201. CIS:   76474,757
  202. AOL:   SKRANS
  203.  
  204. Many thanks to Bill Steinberg for writing DisplayDA!  Click on the "About DisplayDA" box below to learn more about it.
  205.  
  206. ‚Ä¢‚Ä¢‚Ä¢ EVOLUTIONS
  207.  
  208. Version:  1.0
  209. Date:     Thursday, December 6, 1990
  210. Comments: First release
  211.  
  212. ‚Ä¢‚Ä¢‚Ä¢ ENDNOTES
  213.  
  214. ^ Not supported by THINK C 4.0.2.
  215. ‚Ć THINK C 4.0.2 specific; may differ on other compilers.